/*
 *  input.h
 *  Sinnca Engine Demo
 *
 *  Created by Ryan Oldis on 1/18/11.
 *  Copyright 2011 Sinnca Studios. All rights reserved.
 *
 */

#include "global.h"


#define input (Input::Instance())


class gamePad
{
	
	
	SDL_Joystick* joystick;
	
	std::string name;
	
	/*
	analogStick leftStick;
	analogStick rightStick;
	
	float trigger_L, trigger_R;
	 */
	std::vector<float> axies;
	
	std::vector<int> buttons;

public:
	
	gamePad();
	~gamePad();
	
	friend class Input;
	
	friend int l_buttonDown(lua_State* L);
	friend int l_analogAxis(lua_State* L);
	
	void printInfo();
	
};




class Input
{
	
	SDL_Event event;
	
	
protected:
	
	Input();
	static Input* _instance;
	
public:
	
	
	gamePad pad;
	
	int keyList[322];
	int m_x, m_y;
	int leftClk, midClk, rightClk;
	
	void listKeys();
	
	~Input();
	
	
	static Input* Instance();
	
	bool Update();
	
	bool IsKeyDown(SDLKey k);
	
};

int l_buttonDown(lua_State* L);
int l_analogAxis(lua_State* L);

int l_reInitGamepad(lua_State* L);

int l_keyDown(lua_State* L);
int l_getMouseCo(lua_State* L);

